package com.example.badmintonCommon.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

//返回值类
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private Integer code;
    private String mes;
    private T data;

    public static <T> Result<T> success(){
        return new Result<>(200, "操作成功", null);
    }

    public static <T> Result<T> success(T data){
        return new Result<>(200, "操作成功", data);
    }

    public static <T> Result<T> error(){
        return new Result<>(500, "操作失败", null);
    }

    public static <T> Result<T> error(T data){
        return new Result<>(500, "操作失败", data);
    }
}
